package com.recruit.dao;

import com.recruit.entity.CompanyUser;
import com.recruit.entity.User;

import java.sql.SQLException;
/****
 * author:丁文彬
 * time：2020.9.25
 */

public class CompanyLoginAndResgitDao extends BaseDao<CompanyUser>{
    //普通用户登录
    public CompanyUser selectUserByUsernameAndPassword(String username, String password) throws SQLException {
        //sql
        String sql = "select * from companyUser where username=? and password=?";
        //调用父类
        CompanyUser companyUser = this.getBean(CompanyUser.class, sql, username, password);
        return companyUser;
    }


    //普通用户注册
    public int insertUser(CompanyUser companyUser) throws SQLException {
        //sql
        String sql = "insert into companyUser values(null,?,?,?,?,?)";
        //调用父类
        int index = this.update(sql, companyUser.getUsername(), companyUser.getPassword(), companyUser.getEmail(), companyUser.getPhone(),  companyUser.getCompanyName());
        return index;
    }


}
